package com.andnnl.queue;

import java.util.PriorityQueue;
import java.util.Random;

public class PriorityQueueTest {
    public static void main(String args[]) {
        PriorityQueue<People> queue = new PriorityQueue<>(
                (p1, p2) -> p2.age - p1.age);

        long t1=System.currentTimeMillis();
        for (int i = 1; i <= 1000000; i++) {
            queue.add(new People("张" + i, (new Random().nextInt(10))));
        }
        while (!queue.isEmpty()) {
            queue.poll();
//            System.out.println(queue.poll().toString());
        }
        long t2=System.currentTimeMillis();
        System.out.println(t2-t1);
    }
}

